package ar.com.maddes.creenciasadventistas.ui;

import java.util.List;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import ar.com.maddes.creenciasadventistas.StripBeliefFragment;
import ar.com.maddes.creenciasadventistas.database.Creencia;

/**
 * A {@link FragmentPagerAdapter} that returns a fragment corresponding to one
 * of the sections/tabs/pages.
 */
public class PagerAdapter extends FragmentPagerAdapter {

	List<String> mTitles;

	public PagerAdapter(FragmentManager fm) {
		super(fm);
		mTitles = Creencia.getTitles();
	}

	@Override
	public Fragment getItem(int position) {
		// getItem is called to instantiate the fragment for the given page.
		// Return a DummySectionFragment (defined as a static inner class
		// below) with the page number as its lone argument.
		Fragment fragment = new StripBeliefFragment();
		Bundle args = new Bundle();
		args.putLong(StripBeliefFragment.ARG_BELIEF_NUMBER, position + 1);
		fragment.setArguments(args);
		return fragment;
	}

	@Override
	public int getCount() {
		return mTitles.size();
	}
	

	@Override
	public CharSequence getPageTitle(int position) {
		return mTitles.get(position); 
	}
}
	